using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BlueFinity.mvNET.CoreObjects;
using mvLibrary.Helpers.Utils;

namespace fenk.Admin.Bancos
{
    public partial class ConfDepositos : mvLibrary.BaseForm
    {
        public ConfDepositos()
        {
            InitializeComponent();
        }
        public override void AfterReadItem()
        {
            base.AfterReadItem();
            UniItem.Dispose(); // limpiar item
            CallProgram("SEL.DEP.PEND", 1, 1);
            EnableToolBox(true);
            FillControls(panelData);
        }
        

        

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void checkTodos_CheckedChanged(object sender, EventArgs e)
        {
            if (checkTodos.Checked)
            {
                for (int a = 0; a < mvDataGridView1.Rows.Count; ++a)
                {
                    mvDataGridView1[2, a].Value = true;
                    UniItem.Replace(3, a + 1, "S");
                }
                checkNinguno.Checked = false;
            }
        }

        private void checkNinguno_CheckedChanged(object sender, EventArgs e)
        {
            if (checkNinguno.Checked)
            {
                for (int a = 0; a < mvDataGridView1.Rows.Count; ++a)
                {
                    mvDataGridView1[2, a].Value = false;
                    UniItem.Replace(3, a + 1, "N");
                }
                checkTodos.Checked = false; 
            }
        }

        private void textTodos_Validated(object sender, EventArgs e)
        {
            if (textTodos.Text != "")
            {
                for (int a = 0; a < mvDataGridView1.Rows.Count; ++a)
                {
                    if (DataBASIC.Field(UniItem.ExtractAsString(1,a+1), "*", 1) == textTodos.Text)
                    {
                        mvDataGridView1[2, a].Value = true;
                        UniItem.Replace(3, a + 1, "S");

                    }
                }
            }
        }

        private void textNinguno_Validated(object sender, EventArgs e)
        {
            if (textNinguno.Text != "")
            {
                for (int a = 0; a < mvDataGridView1.Rows.Count; ++a)
                {
                    if (DataBASIC.Field(UniItem.ExtractAsString(1, a + 1), "*", 1) == textNinguno.Text)
                    {
                        mvDataGridView1[2, a].Value = false;
                        UniItem.Replace(3, a + 1, "N");
                    }
                    
                }
            }
        }

        private void panelData_Paint(object sender, PaintEventArgs e)
        {

        }
    }
}

